
import unittest

from Schedule.WeekendCallEvaluator import WeekendCallEvaluator
from Schedule.Doctors import Doctors

class WeekendCallEvaluatorTestCases(unittest.TestCase):
    def setUp(self):
        self._initCount = dict()
        for i in range(0, len (Doctors().doctorNames)):
            self._initCount[i] = 0;
    
    def test_May1(self):
        
        weekendCallIndex = [0, 15, 18, 19, 34, 37, 38, 53, 56, 57, 72, 75, 76, 77]
        chromosome = [0, 4, 1, 3, 5, 5, 2, 1, 4, 3, 0, 2, 0, 2, 1, 3, 1, 1, 5, 2, 3, 1, 4, 0, 0, 1, 4, 2, 4, 2, 4, 5, 2, 4, 0, 3, 3, 1, 4, 5, 3, 0, 1, 1, 1, 4, 2, 1, 3, 5, 5, 3, 3, 2, 1, 3, 4, 1, 3, 1, 0, 5, 5, 2, 0, 4, 0, 1, 3, 2, 0, 3, 1, 5, 4, 2, 2, 3, 0, 5, 2, 1]
        
        score = WeekendCallEvaluator(weekendCallIndex, self._initCount).evaluate(chromosome, False)
        self.assertEquals(score, 12)

    def test_1(self):
        
        weekendCallIndex = [0, 1, 2, 3, 4, 5]
        chromosome = [0, 1, 2, 3, 4, 5]
        
        score = WeekendCallEvaluator(weekendCallIndex, self._initCount).evaluate(chromosome, False)
        self.assertEquals(score, 6)

    def test_2(self):
        
        weekendCallIndex = [0, 1, 2, 3, 4, 5]
        chromosome = [0, 1, 2, 3, 4, 0]
        
        score = WeekendCallEvaluator(weekendCallIndex, self._initCount).evaluate(chromosome, False)
        self.assertEquals(score, 5)

    def test_3(self):
        
        weekendCallIndex = [0, 1, 2, 3, 4, 5]
        chromosome = [0, 1, 2, 3, 0, 0]
        
        score = WeekendCallEvaluator(weekendCallIndex, self._initCount).evaluate(chromosome, False)
        self.assertEquals(score, 4)

    def test_4(self):
        
        weekendCallIndex = [0, 1, 2, 3, 4, 5]
        chromosome = [0, 1, 2, 0, 0, 0]
        
        score = WeekendCallEvaluator(weekendCallIndex, self._initCount).evaluate(chromosome, False)
        self.assertEquals(score, 3)

    def test_MinimumScore(self):
        
        weekendCallIndex = [0, 1, 2, 3, 4, 5]
        chromosome = [0, 0, 0, 0, 0, 0]
        
        score = WeekendCallEvaluator(weekendCallIndex, self._initCount).evaluate(chromosome, False)
        self.assertEquals(score, 0)
